import request from "@/utils/request";
import type { TradeMark, TradeMarkResponseDate } from "./type/type";
//获取产品信息接口
export const reqProductInfo = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseDate>(
    `/admin/product/baseTrademark/${page}/${limit}`
  );
//新增或者修改品牌数据，因为二者接口只有是否有id这一个区别，所以封装到一块
export const reqMarkAddORUpdate = (data: TradeMark) => {
  if (data.id) {
    //有id是修改
    //接口返回数据是null，所以是任何类型

    return request.put<any, any>("/admin/product/baseTrademark/update", data);
  } else {
    //没id是新增
    return request.post<any, any>("/admin/product/baseTrademark/save", data);
  }
};
//删除接口
export const reqDelProduct = (id: number) =>
  request.delete(`/admin/product/baseTrademark/remove/${id}`);
